package com.dfcd.commonlib.retrofit;

import rx.functions.Func1;

/**
 * 给返回结果去掉状态码等属性,
 * 如果是查询出错,则返回状态码对应的描述给用户
 *
 * @author zengyi
 *         create at 2017/1/16 16:09
 */
public class ResultFilter<T> implements Func1<BaseResult<T>, T> {
	@Override
	public T call(BaseResult<T> baseResult) {
		if (!baseResult.getCode().equals("0")) {
			throw new HttpTimeException(baseResult.getMsg());
		}
		return baseResult.getData();
	}
}